fix: refresh scroller layout when tool confirmation dialog is cancelled#254
fix: refresh scroller layout when tool confirmation dialog is cancelled#254rsd-darshan wants to merge 3 commits into
Conversation
When the user cancels a subagent tool confirmation dialog, the subagent panel stays expanded at its pre-cancel height. This happens because cancelConfirmation() only calls parent.layout() (relaying the turn widget's children), but never updates the ScrolledComposite's minimum size via refreshScrollerLayout(). On the Continue path this goes unnoticed because subsequent subagent messages trigger a layout refresh; on the Cancel path no further messages arrive, so the panel is stuck. Fix by walking up the ancestor chain after parent.layout() to find the ChatContentViewer and calling refreshScrollerLayout(), which recomputes setMinHeight() and collapses the scroll area correctly. Fixes microsoft#169
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the cancel-confirmation UI flow so the chat panel properly collapses after a tool invocation is canceled, even when no further messages arrive to trigger another layout pass.
Changes:
- After cancellation, traverses ancestor composites to find the
ChatContentViewer. - Calls
ChatContentViewer.refreshScrollerLayout()to recompute the scroller’s minimum size so the panel can shrink.
When the user cancels a subagent tool confirmation dialog, the subagent panel stays expanded at its pre-cancel height. This happens because cancelConfirmation() only called parent.layout() (relaying the turn widget's children), but never updated the ScrolledComposite's minimum size via refreshScrollerLayout(). On the Continue path this goes unnoticed because subsequent subagent messages trigger a layout refresh; on the Cancel path no further messages arrive, so the panel is stuck. Fix by passing a Runnable callback from BaseTurnWidget into the dialog at construction time. BaseTurnWidget walks up the ancestor chain once to find ChatContentViewer and captures refreshScrollerLayout() as the callback. cancelConfirmation() calls it after disposal, which recomputes setMinHeight() in a single layout pass and collapses the panel correctly. This also removes the redundant parent.layout() call that preceded the deep layout(true,true) inside refreshScrollerLayout(). Fixes microsoft#169
|
Thanks for tracking down the root cause. I agree that the missing piece is recomputing the I would prefer not to inject a layout callback into
That should fix the stuck subagent panel for cancel, accept, and programmatic cancellation uniformly, while keeping scroller-specific behavior out of |
Summary
cancelConfirmation()callsparent.layout()(relays the turn widget's children) but never updates theScrolledComposite's minimum size viarefreshScrollerLayout()Fix
Pass a
Runnablecallback fromBaseTurnWidgetintoInvokeToolConfirmationDialogat construction.BaseTurnWidgetwalks up the ancestor chain once to findChatContentViewerand capturesrefreshScrollerLayout()as the callback.cancelConfirmation()calls it after disposal, which recomputessetMinHeight()in a single layout pass and collapses the panel correctly. This also removes the redundantparent.layout()call that preceded the deeplayout(true,true)insiderefreshScrollerLayout().Test plan
Fixes #169